<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:form id="frmTitle">
        <p:growl id="msgs" showDetail="false"/>
        <h:panelGrid columns="2" cellpadding="1">
            <h:outputText value="#{msgs.solicitacaoLgdLista}" styleClass="fontTitle"/>
        </h:panelGrid>
    </h:form>

    <h:panelGrid columns="2" width="100%">

        <h:form id="frmSearch">

            <h:panelGrid columns="3">

                <p:commandLink id="refreshTable" actionListener="#{alunoSolicitacaoMB.atualizarTabela}" title="#{msgs.btnAtualizar}"  update=":frmDataTable:tbl" >
                    <h:graphicImage value="img/refresh.png" style="border: 0" />
                </p:commandLink>

                <p:inputText id="txtBusca" value="#{alunoSolicitacaoMB.busca}" size="35" />
                <p:commandButton id="btnSearch" value="#{msgs.btnBuscar}" alt="#{msgs.btnBuscar}" title="#{msgs.btnBuscar}" actionListener="#{alunoSolicitacaoMB.buscar}" icon="ui-icon ui-icon-search" update=":frmDataTable:tbl"/>

            </h:panelGrid>

        </h:form>

    </h:panelGrid>

    <h:form id="frmDataTable">

        <p:fieldset legend="#{msgs.solicitacaoLgdLista}">

            <h:panelGrid width="100%">            

                <p:dataTable id="tbl" var="tbl" paginator="true" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15" rows="10"
                             emptyMessage="#{msgs.msgTabelaVazia}" value="#{alunoSolicitacaoMB.lssolicitacao}">
                    <f:facet name="header">
                        <h:outputText value="#{msgs.solicitacaoTblTitulo}"/>                    
                    </f:facet>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.descricao}"/>
                        </f:facet>
                        <h:outputText value="#{tbl.modeloSolicitacao.descricao}"/>
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.colDtCriacao}"/>
                        </f:facet>
                        <h:outputText value="#{tbl.dtcriacao}">
                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                        </h:outputText>
                    </p:column>
                    
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.colDtPrazo}"/>
                        </f:facet>
                        <h:outputText value="#{alunoSolicitacaoMB.calculaData(tbl.dtcriacao,tbl)}">
                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                        </h:outputText>
                    </p:column>
                    
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.status}"/>
                        </f:facet>
                        <h:outputText value="#{alunoSolicitacaoMB.strStatusLabel(tbl.status)}"/>
                    </p:column>

                    <p:column style="width:160px">
                        <p:commandButton id="btnVisualizar" alt="#{msgs.btnVisualizar}" title="#{msgs.btnVisualizar}" icon="ui-icon ui-icon-search" oncomplete="dlgVisualizar.show()" actionListener="#{alunoSolicitacaoMB.visualizar(tbl)}" update=":frmVisualizar" />
                        <p:commandButton id="btnCancelar" alt="#{msgs.btnCancelar}" title="#{msgs.btnCancelar}" icon="ui-icon ui-icon-close" oncomplete="cfmDlgCancelar.show()" actionListener="#{alunoSolicitacaoMB.selecionarRegistro(tbl)}" update=":frmCancelar"/>
                    </p:column>

                </p:dataTable>

            </h:panelGrid>

        </p:fieldset>

    </h:form>
        
    <h:form id="frmVisualizar">
        
        <p:dialog header="#{msgs.visualizar}" widgetVar="dlgVisualizar" width="750"  resizable="false" modal="true" styleClass="styleDialog">
            
            
            <p:fieldset legend="#{msgs.solicitacaoDlgLgdVisualizar}">
                
                    <h:panelGrid columns="2">
                    
                    <h:outputLabel value="#{msgs.descricao}: "/>
                    <h:outputText value="#{alunoSolicitacaoMB.strdescricao}"/>
                        
                    <h:outputLabel value="#{msgs.dtcriacao}: "/>
                    <h:outputText value="#{alunoSolicitacaoMB.strdtcriacao}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:outputText>
                        
                    <h:outputLabel value="#{msgs.etapaAtual}: "/>
                    <h:outputText value="#{alunoSolicitacaoMB.stretapaatual}"/>
                    
                    <h:outputLabel value="#{msgs.departamentoResponsavel}: "/>
                    <h:outputText value="#{alunoSolicitacaoMB.strdepartamento}"/>
                        
                    <h:outputLabel value="#{msgs.status}: "/>
                    <h:outputText value="#{alunoSolicitacaoMB.stretapaatualstatus}"/>
                        
                    <h:outputLabel value="#{msgs.colDtPrazo}: "/>
                    <h:outputText value="#{alunoSolicitacaoMB.strprazo}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:outputText>
                        
                </h:panelGrid>
                        
            </p:fieldset>
                  <p:commandButton style="width:90px;margin-bottom: 10px;margin-top: 10px;" value="#{msgs.btnFechar}" alt="#{msgs.btnFechar}" title="#{msgs.btnFechar}" onclick="dlgVisualizar.hide()" styleClass="centerButton"/>
        </p:dialog>
            
    </h:form>
        
    <h:form id="frmCancelar">
         
        <p:confirmDialog id="confirmDialogCancelar" header="#{msgs.solicitacaoDlgTituloCancelar}" message=" #{msgs.dlgMsgCancelar} #{alunoSolicitacaoMB.solicitacaoselecionada.modeloSolicitacao.descricao} ?"
                         width="300" height="60" severity="alert" widgetVar="cfmDlgCancelar">
                             
            <p:commandButton value="#{msgs.btnSim}" oncomplete="cfmDlgCancelar.hide()" alt="#{msgs.btnSim}" title="#{msgs.btnSim}" actionListener="#{alunoSolicitacaoMB.cancelar}"
                             update=":frmTitle:msgs,:frmDataTable:tbl"/>
            <p:commandButton value="#{msgs.btnNao}" onclick="cfmDlgCancelar.hide()" alt="#{msgs.btnNao}" title="#{msgs.btnNao}" type="button"/>
                
        </p:confirmDialog>
            
    </h:form>

</html>

